/**
 * Copyright (c) 2016. Visionet and/or its affiliates. All right reserved.
 * VISIONET PROPRIETARY/CONFIDENTIAL.
 */
package com.visionet.jumper.core.domain.search;

import com.visionet.jumper.core.domain.bean.Page;
import com.visionet.jumper.core.domain.search.enumdata.SearchOperator;
import com.visionet.jumper.core.domain.search.filter.HqlJoinTable;
import com.visionet.jumper.core.domain.search.filter.JoinTableCondition;
import com.visionet.jumper.core.domain.search.filter.OrCondition;
import com.visionet.jumper.core.domain.search.filter.SearchFilter;
import com.visionet.jumper.core.exception.runtime.FrameworkException;

import javax.persistence.Entity;
import java.util.List;

public class HqlSearchable extends Searchable {

	/**
	 * @param c 类名
	 * @param alias 别名
	 */
	public HqlSearchable (Class<?> c, String alias) {
		Entity entity = (Entity) c.getAnnotation(Entity.class);
		if(null == entity) {
			throw new FrameworkException("["+c.getName()+"] is not a hibernate persistent class! ");
		}
		super.table(c.getName(), alias);
	}

	public HqlSearchable transferResult(Class<?> targetClass) {
		super.setTransfer(targetClass);
		return this;
	}

	@Override
	public HqlSearchable linkConditions(String field1, String field2) {
		super.linkConditions(field1, field2);
		return this;
	}

	@Override
	public HqlSearchable table(String tableName, String alias) {
		super.table(tableName, alias);
		return this;
	}

	@Override
	public HqlSearchable join(String tableName, String alias) {
		super.join(tableName, alias);
		return this;
	}

	@Override
	public HqlSearchable join(Class<?> c, String alias) {
		super.join(c, alias);
		return this;
	}

	@Override
	public HqlSearchable eq(String field, Object obj) {
		super.eq(field, obj);
		return this;
	}

	@Override
	public HqlSearchable eq(String field, Object obj, String type) {
		super.eq(field, obj, type);
		return this;
	}

	@Override
	public HqlSearchable ne(String field, Object obj) {
		super.ne(field, obj);
		return this;
	}

	@Override
	public HqlSearchable ne(String field, Object obj, String type) {
		super.ne(field, obj, type);
		return this;
	}

	@Override
	public HqlSearchable gt(String field, Object obj) {
		super.gt(field, obj);
		return this;
	}

	@Override
	public HqlSearchable gt(String field, Object obj, String type) {
		super.gt(field, obj, type);
		return this;
	}

	@Override
	public HqlSearchable gte(String field, Object obj) {
		super.gte(field, obj);
		return this;
	}

	@Override
	public HqlSearchable gte(String field, Object obj, String type) {
		super.gte(field, obj, type);
		return this;
	}

	@Override
	public HqlSearchable lt(String field, Object obj) {
		super.lt(field, obj);
		return this;
	}

	@Override
	public HqlSearchable lt(String field, Object obj, String type) {
		super.lt(field, obj, type);
		return this;
	}

	@Override
	public HqlSearchable lte(String field, Object obj) {
		super.lte(field, obj);
		return this;
	}

	@Override
	public HqlSearchable lte(String field, Object obj, String type) {
		super.lte(field, obj, type);
		return this;
	}

	@Override
	public HqlSearchable prefixLike(String field, Object obj) {
		super.prefixLike(field, obj);
		return this;
	}

	@Override
	public HqlSearchable prefixLike(String field, Object obj, String type) {
		super.prefixLike(field, obj, type);
		return this;
	}

	@Override
	public HqlSearchable prefixNotLike(String field, Object obj) {
		super.prefixNotLike(field, obj);
		return this;
	}

	@Override
	public HqlSearchable prefixNotLike(String field, Object obj, String type) {
		super.prefixNotLike(field, obj, type);
		return this;
	}

	@Override
	public HqlSearchable suffixLike(String field, Object obj) {
		super.suffixLike(field, obj);
		return this;
	}

	@Override
	public HqlSearchable suffixLike(String field, Object obj, String type) {
		super.suffixLike(field, obj, type);
		return this;
	}

	@Override
	public HqlSearchable suffixNotLike(String field, Object obj) {
		super.suffixNotLike(field, obj);
		return this;
	}

	@Override
	public HqlSearchable suffixNotLike(String field, Object obj, String type) {
		super.suffixNotLike(field, obj, type);
		return this;
	}

	@Override
	public HqlSearchable like(String field, Object obj) {
		super.like(field, obj);
		return this;
	}

	@Override
	public HqlSearchable like(String field, Object obj, String type) {
		super.like(field, obj, type);
		return this;
	}

	@Override
	public HqlSearchable notLike(String field, Object obj) {
		super.notLike(field, obj);
		return this;
	}

	@Override
	public HqlSearchable notLike(String field, Object obj, String type) {
		super.notLike(field, obj, type);
		return this;
	}

	@Override
	public HqlSearchable isNull(String field, Object obj) {
		super.isNull(field, obj);
		return this;
	}

	@Override
	public HqlSearchable isNull(String field, Object obj, String type) {
		super.isNull(field, obj, type);
		return this;
	}

	@Override
	public HqlSearchable isNotNull(String field, Object obj) {
		super.isNotNull(field, obj);
		return this;
	}

	@Override
	public HqlSearchable isNotNull(String field, Object obj, String type) {
		super.isNotNull(field, obj, type);
		return this;
	}

	@Override
	public HqlSearchable in(String field, Object obj) {
		super.in(field, obj);
		return this;
	}

	@Override
	public HqlSearchable in(String field, Object obj, String type) {
		super.in(field, obj, type);
		return this;
	}

	@Override
	public HqlSearchable notIn(String field, Object obj) {
		super.notIn(field, obj);
		return this;
	}

	@Override
	public HqlSearchable notIn(String field, Object obj, String type) {
		super.notIn(field, obj, type);
		return this;
	}

	@Override
	public HqlSearchable condition(String string, List<Object> obj) {
		super.condition(string, obj);
		return this;
	}

	@Override
	public HqlSearchable or(OrCondition orCondition1, OrCondition orCondition2, OrCondition... orConditions) {
		super.or(orCondition1, orCondition2, orConditions);
		return this;
	}

	@Override
	public HqlSearchable havingEq(String field, Object obj) {
		super.havingEq(field, obj);
		return this;
	}

	@Override
	public HqlSearchable havingEq(String field, Object obj, String type) {
		super.havingEq(field, obj, type);
		return this;
	}

	@Override
	public HqlSearchable havingNe(String field, Object obj) {
		super.havingNe(field, obj);
		return this;
	}

	@Override
	public HqlSearchable havingNe(String field, Object obj, String type) {
		super.havingNe(field, obj, type);
		return this;
	}

	@Override
	public HqlSearchable havingGt(String field, Object obj) {
		super.havingGt(field, obj);
		return this;
	}

	@Override
	public HqlSearchable havingGt(String field, Object obj, String type) {
		super.havingGt(field, obj, type);
		return this;
	}

	@Override
	public HqlSearchable havingGte(String field, Object obj) {
		super.havingGte(field, obj);
		return this;
	}

	@Override
	public HqlSearchable havingGte(String field, Object obj, String type) {
		super.havingGte(field, obj, type);
		return this;
	}

	@Override
	public HqlSearchable havingLt(String field, Object obj) {
		super.havingLt(field, obj);
		return this;
	}

	@Override
	public HqlSearchable havingLt(String field, Object obj, String type) {
		super.havingLt(field, obj, type);
		return this;
	}

	@Override
	public HqlSearchable havingLte(String field, Object obj) {
		super.havingLte(field, obj);
		return this;
	}

	@Override
	public HqlSearchable havingLte(String field, Object obj, String type) {
		super.havingLte(field, obj, type);
		return this;
	}

	@Override
	public HqlSearchable havingPrefixLike(String field, Object obj) {
		super.havingPrefixLike(field, obj);
		return this;
	}

	@Override
	public HqlSearchable havingPrefixLike(String field, Object obj, String type) {
		super.havingPrefixLike(field, obj, type);
		return this;
	}

	@Override
	public HqlSearchable havingPrefixNotLike(String field, Object obj) {
		super.havingPrefixNotLike(field, obj);
		return this;
	}

	@Override
	public HqlSearchable havingPrefixNotLike(String field, Object obj, String type) {
		super.havingPrefixNotLike(field, obj, type);
		return this;
	}

	@Override
	public HqlSearchable havingSuffixLike(String field, Object obj) {
		super.havingSuffixLike(field, obj);
		return this;
	}

	@Override
	public HqlSearchable havingSuffixLike(String field, Object obj, String type) {
		super.havingSuffixLike(field, obj, type);
		return this;
	}

	@Override
	public HqlSearchable havingSuffixNotLike(String field, Object obj) {
		super.havingSuffixNotLike(field, obj);
		return this;
	}

	@Override
	public HqlSearchable havingSuffixNotLike(String field, Object obj, String type) {
		super.havingSuffixNotLike(field, obj, type);
		return this;
	}

	@Override
	public HqlSearchable havingLike(String field, Object obj) {
		super.havingLike(field, obj);
		return this;
	}

	@Override
	public HqlSearchable havingLike(String field, Object obj, String type) {
		super.havingLike(field, obj, type);
		return this;
	}

	@Override
	public HqlSearchable havingNotLike(String field, Object obj) {
		super.havingNotLike(field, obj);
		return this;
	}

	@Override
	public HqlSearchable havingNotLike(String field, Object obj, String type) {
		super.havingNotLike(field, obj, type);
		return this;
	}

	@Override
	public HqlSearchable havingIsNull(String field, Object obj) {
		super.havingIsNull(field, obj);
		return this;
	}

	@Override
	public HqlSearchable havingIsNull(String field, Object obj, String type) {
		super.havingIsNull(field, obj, type);
		return this;
	}

	@Override
	public HqlSearchable havingIsNotNull(String field, Object obj) {
		super.havingIsNotNull(field, obj);
		return this;
	}

	@Override
	public HqlSearchable havingIsNotNull(String field, Object obj, String type) {
		super.havingIsNotNull(field, obj, type);
		return this;
	}

	@Override
	public HqlSearchable havingIn(String field, Object obj) {
		super.havingIn(field, obj);
		return this;
	}

	@Override
	public HqlSearchable havingIn(String field, Object obj, String type) {
		super.havingIn(field, obj, type);
		return this;
	}

	@Override
	public HqlSearchable havingNotIn(String field, Object obj) {
		super.havingNotIn(field, obj);
		return this;
	}

	@Override
	public HqlSearchable havingNotIn(String field, Object obj, String type) {
		super.havingNotIn(field, obj, type);
		return this;
	}

	@Override
	public HqlSearchable havingCondition(String string, List<Object> obj) {
		super.havingCondition(string, obj);
		return this;
	}

	@Override
	public HqlSearchable groupBy(String field) {
		super.groupBy(field);
		return this;
	}

	@Override
	public HqlSearchable ascSort(String field) {
		super.ascSort(field);
		return this;
	}

	@Override
	public HqlSearchable descSort(String field) {
		super.descSort(field);
		return this;
	}

	@Override
	public HqlSearchable select(String field) {
		super.select(field);
		return this;
	}

	@Override
	public HqlSearchable addJoinTable(JoinTableCondition joinTable) {
		super.addJoinTable(joinTable);
		return this;
	}

	@Override
	public SearchFilter addCondition(String field, Object obj, String type, SearchOperator searchOperator) {
		return super.addCondition(field, obj, type, searchOperator);
	}

	@Override
	public void setPage(Page page) {
		super.setPage(page);
	}

	public void addJoinTable(HqlJoinTable joinTable) {
		super.addJoinTable(joinTable);
	}
}
